<template>
  <TableView
    ref="tableView"
    :table-attrs="{ api: getPage, descs: ['createTime'], payloadStyle: 'body' }"
    form-path="/{{frontendFilePrefix}}Form/{id:-1}"
    :search-model="searchForm"
    :delete-api="batchDelete"
    :toolbar-attrs="{ buttons: ['slot', 'del', 'create'] }">
    <template #columns>{{#each columns}}{{table dataType maxLength prop label table}}{{/each}}
    </template>
    <template #search-form>{{#each columns}}{{search dataType maxLength prop label search false}}{{/each}}
    </template>
  </TableView>
</template>

<script>
  import { getPage, batchDelete } from './api'

  export default {
    name: '{{frontendFilePrefix}}View',
    data() {
      return {
        searchForm: {
{{#each columns}}{{search dataType maxLength prop label search true}}{{/each}}
        }
      }
    },
    methods: {
      getPage,
      batchDelete
    }
  }
</script>
